package com.anyou.mall.goo.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.anyou.common.annotation.Log;
import com.anyou.common.core.controller.BaseController;
import com.anyou.common.core.domain.ApiResult;
import com.anyou.common.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.anyou.mall.goo.domain.JfDrawRecord;
import com.anyou.mall.goo.service.IJfDrawRecordService;
import com.anyou.common.utils.poi.ExcelUtil;
import com.anyou.common.core.page.TableDataInfo;

/**
 * 积分抽奖中奖记录Controller
 *
 * @author clx
 * @date 2023-10-24
 */
@Api(tags = "积分抽奖中奖记录")
@RestController
@RequestMapping("/integralDraw/drawRecord")
public class JfDrawRecordController extends BaseController
{
    @Autowired
    private IJfDrawRecordService jfDrawRecordService;

    /**
     * 查询积分抽奖中奖记录列表
     */
    @ApiOperation("查询积分抽奖中奖记录列表")
    @PreAuthorize("@ss.hasPermi('integralDraw:drawRecord:list')")
    @GetMapping("/list")
    public TableDataInfo<List<JfDrawRecord>> list(JfDrawRecord jfDrawRecord)
    {
        startPage();
        List<JfDrawRecord> list = jfDrawRecordService.selectJfDrawRecordList(jfDrawRecord);
        return getDataTable(list);
    }

    /**
     * 导出积分抽奖中奖记录列表
     */
    //@ApiOperation("导出积分抽奖中奖记录列表")
    //@PreAuthorize("@ss.hasPermi('integralDraw:drawRecord:export')")
    //@Log(title = "积分抽奖中奖记录", businessType = BusinessType.EXPORT)
    //@PostMapping("/export")
    //public void export(HttpServletResponse response, JfDrawRecord jfDrawRecord)
    //{
    //    List<JfDrawRecord> list = jfDrawRecordService.selectJfDrawRecordList(jfDrawRecord);
    //    ExcelUtil<JfDrawRecord> util = new ExcelUtil<JfDrawRecord>(JfDrawRecord.class);
    //    util.exportExcel(response, list, "积分抽奖中奖记录数据");
    //}

    /**
     * 获取积分抽奖中奖记录详细信息
     */
    //@ApiOperation("获取积分抽奖中奖记录详细信息")
    //@PreAuthorize("@ss.hasPermi('integralDraw:drawRecord:query')")
    //@GetMapping(value = "/{drawRecordId}")
    //public ApiResult<JfDrawRecord> getInfo(@PathVariable("drawRecordId") Long drawRecordId)
    //{
    //    return ApiResult.success(jfDrawRecordService.selectJfDrawRecordByDrawRecordId(drawRecordId));
    //}

    /**
     * 新增积分抽奖中奖记录
     */
    //@ApiOperation("新增积分抽奖中奖记录")
    //@PreAuthorize("@ss.hasPermi('integralDraw:drawRecord:add')")
    //@Log(title = "积分抽奖中奖记录", businessType = BusinessType.INSERT)
    //@PostMapping
    //public ApiResult add(@RequestBody JfDrawRecord jfDrawRecord)
    //{
    //    return ApiResult.success(jfDrawRecordService.insertJfDrawRecord(jfDrawRecord));
    //}

    /**
     * 修改积分抽奖中奖记录
     */
    //@ApiOperation("修改积分抽奖中奖记录")
    //@PreAuthorize("@ss.hasPermi('integralDraw:drawRecord:edit')")
    //@Log(title = "积分抽奖中奖记录", businessType = BusinessType.UPDATE)
    //@PutMapping
    //public ApiResult edit(@RequestBody JfDrawRecord jfDrawRecord)
    //{
    //    return ApiResult.success(jfDrawRecordService.updateJfDrawRecord(jfDrawRecord));
    //}

    /**
     * 删除积分抽奖中奖记录
     */
    @ApiOperation("删除积分抽奖中奖记录")
    @PreAuthorize("@ss.hasPermi('integralDraw:drawRecord:remove')")
    @Log(title = "积分抽奖中奖记录", businessType = BusinessType.DELETE)
    @DeleteMapping("/{drawRecordIds}")
    public ApiResult remove(@PathVariable Long[] drawRecordIds)
    {
        return ApiResult.success(jfDrawRecordService.deleteJfDrawRecordByDrawRecordIds(drawRecordIds));
    }
}
